﻿using System;
using Controls;
using UnityEngine;
using World;

namespace Visual
{
    public class CameraFollowPoint : MonoBehaviour
    {
        [SerializeField] private PlayerController player;
        

        private void Update()
        {
            UpdatePosition();
        }

        private void UpdatePosition()
        {
            Vector3 mousePosition = player.GetMouseWorldPosition();
            transform.position = (player.transform.position + mousePosition) / 2f;
            transform.position = Vector3.ClampMagnitude(transform.position, WorldInfo.Instance.WorldRadius);
        }
    }
}